﻿#VisualFreeBasic_Form#  Version=5.5.5
Locked=0

[Form]
Name=Form1
ClassStyle=CS_VREDRAW,CS_HREDRAW,CS_DBLCLKS
ClassName=
WinStyle=WS_THICKFRAME,WS_CAPTION,WS_SYSMENU,WS_MINIMIZEBOX,WS_CLIPSIBLINGS,WS_CLIPCHILDREN,WS_VISIBLE,WS_EX_WINDOWEDGE,WS_EX_CONTROLPARENT,WS_EX_LEFT,WS_EX_LTRREADING,WS_EX_RIGHTSCROLLBAR,WS_POPUP,WS_SIZEBOX
Style=3 - 常规窗口
Icon=
Caption=MSI文件解压助手
StartPosition=1 - 屏幕中心
WindowState=0 - 正常
Enabled=True
Repeat=False
Left=0
Top=0
Width=420
Height=186
TopMost=False
Child=False
MdiChild=False
TitleBar=True
SizeBox=True
SysMenu=True
MaximizeBox=False
MinimizeBox=True
Help=False
Hscroll=False
Vscroll=False
MinWidth=0
MinHeight=0
MaxWidth=0
MaxHeight=0
NoActivate=False
MousePass=False
TransPer=0
TransColor=SYS,25
Shadow=0 - 无阴影
BackColor=SYS,15
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
AcceptFiles=False

[TextBox]
Name=Text1
Index=-1
Style=3 - 凹边框
TextScrollBars=0 - 无滚动条
Text=此处显示路径
Enabled=False
Visible=True
MaxLength=0
ForeColor=SYS,8
BackColor=SYS,5
Font=微软雅黑,9,0
TextAlign=0 - 左对齐
PasswordChar=
Locked=False
HideSelection=True
Multiline=False
Uppercase=False
Lowercase=False
Number=False
AutoHScroll=True
AutoVScroll=False
Left=32
Top=17
Width=340
Height=27
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
LeftMargin=0
RightMargin=0
AcceptFiles=False

[Button]
Name=Command1
Index=-1
Caption=选择文件
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=32
Top=70
Width=60
Height=50
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False

[Button]
Name=Command2
Index=-1
Caption=解压
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=312
Top=70
Width=60
Height=50
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False


[AllCode]
'这是标准的工程模版，你也可做自己的模版。
'写好工程，复制全部文件到VFB软件文件夹里【template】里即可，子文件夹名为 VFB新建工程里显示的名称
'快去打造属于你自己的工程模版吧。

Sub Form1_Command1_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Dim As String MsiFilename = FF_OpenFileDialog(hWndForm ,"msi" , ,ExePath ,"Windows安装程序(*.msi)|*.msi" , ,0 ,1)
   Text1.Text = MsiFilename
   Dim As Integer SpaceStr = InStr(MsiFilename ," ")
   If SpaceStr > 0 Then
      Text1.Text = """" & MsiFilename & """"
   End If
   If MsiFilename <> "" Then
      Command2.Enabled = True
   Else
      Command2.Enabled = False
   End If
   
End Sub

Sub Form1_Command2_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Dim As String npath = Text1.Text
   If Left(npath ,1) = """" Then
      npath = Left(npath ,InStrRev(npath ,".msi")-1) & """"
   Else
      npath = Left(npath ,InStrRev(npath ,".msi")-1)
   End If
   'MsgBox npath
   Exec("C:\Windows\System32\msiexec.exe" ,"/a " & Text1.Text & " /qn+ TARGETDIR=" & npath)
   Command2.Enabled = False
End Sub

Sub Form1_Shown(hWndForm As hWnd ,UserData As Integer) '窗口完全显示后。UserData 来自显示窗口最后1个参数。
   Command2.Enabled = False
End Sub




